package com.ytjj.qmyx.users.controller;

import com.ytjj.qmyx.users.model.UserBalanceDto;
import com.ytjj.qmyx.users.service.UserBalanceService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * 用户抵扣余额控制器
 *
 *
 *  *
 **/
@RestController
@RequestMapping("/balance")
public class UserBalanceController {

    @Resource
    private UserBalanceService userBalanceService;


    /**
     * 获取用户可抵扣余额
     *
     */
    @GetMapping("getMoney")
    public BigDecimal getMoney(@RequestParam Integer userId) {
        return userBalanceService.getMoney(userId);
    }

    /**
     * 用户金额加减
     *
     */
    @PostMapping("update")
    public void updateMoney(@RequestBody UserBalanceDto userBalanceDto) {
        userBalanceService.update(userBalanceDto);
    }
}
